
import javax.swing.*;

public class FrameMenuProgGUI extends ProgressGUI {

   private JFrame frame = new JFrame( "DARSI" );
   private JMenu progress = new JMenu( "Progress" );
   private JMenuItem stageItem = new JMenuItem( "Initializing" );
   private JMenuItem timeItem = new JMenuItem( "0 / " + workTimeMin + " mins" );
   private JMenuBar menuBar = new JMenuBar();

   public FrameMenuProgGUI( int workTimeMin, int breakTimeMin, int voteTimeMin ) {
      super( workTimeMin, breakTimeMin, voteTimeMin );
      progress.add( stageItem );
      progress.addSeparator();
      progress.add( timeItem );
      menuBar.add( progress );
      frame.setJMenuBar( menuBar );
      frame.pack();
      frame.show();
   }
   
   private void setStageTitle( int stage ) {
      System.out.println( "Stage: " + ProgressGUI.stages[ stage-1 ] );
      stageItem.setLabel( ProgressGUI.stages[ stage-1 ] );
   }
   
   public void setProgress( int stage, int progress ) {
      System.out.println( "Progress: " + progress );
      String progressStr = "" + progress + " / ";
      if( stage == ProgressGUI.WORK_STAGE ) {
         progressStr += Darsi.DARSI_DEFAULT_WAIT_MINS;
      } else if ( stage == ProgressGUI.BREAK_STAGE ) {
         progressStr += Darsi.DARSI_DEFAULT_BREAK_MINS;
      } else {
         progressStr += Darsi.DARSI_DEFAULT_VOTE_MINS;
      }
      progressStr += " mins";
      timeItem.setLabel( progressStr );
   }
}
